# -*- mode: snippet -*-
# name: docx extract tables template
# key: template.docx.extract.tables
# contributor: Shuguang Sun
# --
# -*- coding: utf-8 -*-
from docx import Document


if __name__ == "__main__":
    document = Document('6 学生成绩报告.docx')

    # 读取表格内容
    for tb in document.tables:
        for i, row in enumerate(tb.rows):
            for j, cell in enumerate(row.cells):
                text = ''
                for p in cell.paragraphs:
                    text += p.text

                print(f'第{i}行，第{j}列的内容{text}')

    document.save('修改后的报告.docx')